<template>
<ChangeStuBind ref="curSutBind"></ChangeStuBind>
</template>

<script>
import ChangeStuBind from "@/components/ChangeStuBind";
import axios from "axios";
import {ElMessage} from "element-plus";
export default {
  name: "ChangeHWKS",
  components: {ChangeStuBind},
  created() {
    this.currId = this.$ses.getSesWithParse(this.$route.query.resId).currId
    // this.homeworkId = this.$ses.getSesWithParse(this.$route.query.resId).homeworkId
    axios.get("/api/teacher/GetStuCurrInfo",{
      params:{
        currId:this.currId
      }
    }).then((res)=>{
      if (res.status===200){
        this.$refs.curSutBind.setup(res.data)
      }
    })
  },
  data(){
    return{
      currId:''
    }
  },
  methods:{
    putdata(map){
      var CheckedstuIdList=[]
      map.forEach((v,k)=>{
        for (const vElement of v) {
          console.log(vElement)
          if (vElement.IfCheck){
            CheckedstuIdList.push(vElement.StuInfo.Id)
          }
        }
      })
      axios.post('/api/teacher/ChangeCurriculumsStu', {
        stuList: CheckedstuIdList,
        curriculumId: this.currId,
      }).then((res) => {
        if (res.status === 200) {
          ElMessage.success(
              {
                message:"成功"
              })
        }
      })
    }
  }
}
</script>

<style scoped>

</style>